package com.googlecode.bubbler.desktop;

import java.awt.Color;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.*;
import com.googlecode.bubbler.desktop.listeners.SearchKeyListener;

public class MainWindow extends JFrame {
    JTextArea out;
    JTextField in;

    MainWindow() {
        super("Bubbler");
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        
        in = new JTextField();
        getContentPane().add(new JScrollPane(in));
        
        out = new JTextArea();
        out.setEditable(false);
        out.setBackground(new Color(220, 220, 220));
         getContentPane().add( new JScrollPane( out ) );
        JButton button = new JButton( "search" );
        
        getContentPane().add( button, "South" );
        SearchKeyListener s = new SearchKeyListener();
        button.addKeyListener( s );
        button.addMouseListener( s );
        setSize(200, 300);
        setVisible(true);
    }

    class SearchKeyListener implements KeyListener, MouseListener {

        public void keyPressed(KeyEvent e) {
            out.append("pressed");
            System.out.println("hfghfgh");
        }

        public void keyReleased(KeyEvent e) {
            out.append("Released");
        }

        public void keyTyped(KeyEvent e) {
            out.append("typed");
        }

        public void mouseClicked(MouseEvent e) {
            out.append("Clicked");
        }

        public void mouseEntered(MouseEvent e) {
            ///out.append("Entered");
        }

        public void mouseExited(MouseEvent e) {
            //out.append("Exited");
        }

        public void mousePressed(MouseEvent e) {
            //out.append("pressed");
        }

        public void mouseReleased(MouseEvent e) {
            //out.append("Released");
        }

    }

    public static void main(String[] args) {
        new MainWindow();
    }
}
